
{
Indicator:          _TickRate

Purpose:            Calculates the tick rate per second over a period of 'Period' seconds.
                    Works for all chart time frames (Month, Week, Day, Minute, Tick)
                    
                    Requires enabling the indicator to Update value intra-bar (tick-by-tick)

Author:             MarkSanDiego

Updated:            06/30/08    original version
                    08/15/10    added multiplier
}

    
inputs:
    Period(60),     { number of seconds over which to average TickRate }
    Mult(1);        { multiplier for TickRate (per second). For example, to display number of ticks in a minute }
                    { instead of in a second, use Mult = 60. }
                        

vars:
    Color(white),
    intrabarpersist TickRate(0),
    Intrabarpersist Barrate(0),
    bool RadarScreen(GetAppInfo(aiApplicationType) = 2);    // true if indicator applied to RadarScreen, false if applied to chart                    ,


if barstatus(1) = 2 and BarInterval > 0 then begin
        BarRate = Ticks;
        Plot3(BarRate, "Bar Rate");
end else
        TickRate = _TickRate(Period) * Mult;

if RadarScreen then begin
    Plot1(Period, "Period (sec)");
    plot2(Mult, "Mult (sec)");
end;    

if TickRate <> 0 then Plot4(TickRate, "Tick Rate");

